/*
 * Project Name spring-boot-tools
 * File Name SubmitRespAction
 * Package Name com.huxiaosu.tools.cmpp.action
 * Create Time 2024/5/19
 * Create by name：liujie
 */
package com.huxiaosu.tools.cmpp.action;

import com.huxiaosu.tools.cmpp.enums.CommandId;
import com.huxiaosu.tools.cmpp.model.MessageHeader;
import com.huxiaosu.tools.cmpp.model.action.SubmitRespMsg;
import lombok.extern.slf4j.Slf4j;
import org.apache.mina.core.buffer.IoBuffer;
import org.springframework.stereotype.Component;

/**
 * Description
 *
 * @author liujie
 * @date 2024/5/19 11:25
 */
@Slf4j
@Component
public class SubmitRespAction extends AbstractMessageAction{

    @Override
    public CommandId getMessageCommandId() {
        return CommandId.CMPP_SUBMIT_RESP;
    }

    @Override
    public String getMessageCommandName() {
        return CommandId.CMPP_SUBMIT_RESP.name();
    }

    @Override
    public SubmitRespMsg readMessage(IoBuffer ioBuffer) {
        SubmitRespMsg submitResp = new SubmitRespMsg();
        submitResp.setMsgId(ioBuffer.getLong());
        submitResp.setResult(ioBuffer.getInt());
        return submitResp;
    }

    @Override
    public void execute() {
        log.info("submit response {}", message.toString());
    }
}
